$("#login-btn").click(function () {
    $.ajax({
        url: 'http://localhost:8080/product-sys/api/login.do',
        type: 'post',
        crossDomain:true,
        xhrFields: {
            withCredentials:true
        },
        data: $("#login-form").serialize(),
        dataType: 'json',
        success: function (responseData) {
            if (responseData.code == 200) {
                // 把当前登录的帐号保存到会话存储中
                sessionStorage.setItem("user", JSON.stringify(responseData.value));
                window.location.href = "index.html";
            } else {
                alert(responseData.msg);
            }
        }
    });
});

$("#yzm").click(function(){
    $(this).hide().prop('src', 'http://localhost:8080/product-sys/api/code.jpg?random=' + Math.random()).fadeIn();
}) ;
